﻿using System;
using System.Linq;

namespace Listing1_23
{
    public static class Program
    {
        public static void Main()
        {
            var numbers = Enumerable.Range(0, 10);

            var parallelResult = numbers.AsParallel()
            .WithDegreeOfParallelism(3)
            .Where(i => i % 2 == 0)
            .ToArray();

            foreach (int i in parallelResult)
                Console.WriteLine(i);
            Console.ReadKey();
        }
    }
}